package com.dyh.shardingJdbc.mapper;

import com.dyh.shardingJdbc.entity.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 订单Mapper接口
 *
 * @author howl-xu
 * @since 2024/3/22
 **/
@Mapper
@Component
public interface OrderMapper {
    /**
     * 新增订单
     *
     * @param price  订单价格
     * @param userId 用户id
     * @param status 订单状态
     * @return
     */
    @Insert("insert into t_order(price,user_id,status) value(#{price},#{userId},#{status})")
    int insertOrder(@Param("price") Double price, @Param("userId") Long userId,
                    @Param("status") String status);

    /**
     * 根据id列表查询多个订单
     *
     * @return
     */
    @Select("select * from t_order")
    List<Order> selectOrderbyIds();

}

